import { MockMethod } from "vite-plugin-mock";

const mock: Array<MockMethod> = [
  {
    //1.获取节日营销活动列表接口
    url: "/dev-api/api/v1/activity/group/page",
    statusCode: 200,
    method: "get",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
        data: {
          list: [
            {
              id: 1,
              name: "mocked-1",
              startTime: "2023-09-01 00:00:00",
              endTime: "2023-12-30 23:59:59",
              numberOfGroupsWaiting: 10,
              numberOfGroupsSuccess: 5,
              status: 1, //0 未开始， 1进行中， 2 已暂停， 3 已结束
            },
            {
              id: 2,
              name: "mocked-2",
              startTime: "2024-01-01 00:00:00",
              endTime: "2024-02-28 23:59:59",
              numberOfGroupsWaiting: 0,
              numberOfGroupsSuccess: 0,
              status: 0, //0 未开始， 1进行中， 2 已暂停， 3 已结束
            },
            {
              id: 3,
              name: "mocked-3",
              startTime: "2023-08-01 00:00:00",
              endTime: "2023-08-08 23:59:59",
              numberOfGroupsWaiting: 0,
              numberOfGroupsSuccess: 10,
              status: 3, //0 未开始， 1进行中， 2 已暂停， 3 已结束
            },
          ],
          total: 3,
        },
      };
    },
  },

  {
    //2.保存活动接口
    url: "/dev-api/api/v1/activity/group",
    statusCode: 200,
    method: "post",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
      };
    },
  },

  {
    //3.1.根据id获取当前编辑的活动信息的接口
    url: "/dev-api/api/v1/activity/group/:id",
    statusCode: 200,
    method: "get",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
        data: {
          id: 1,
          name: "mocked data",
          startTime: "2023-09-01 00:00:00",
          endTime: "2023-12-30 00:00:00",
          limitHours: 24,
          limitMembers: 2,
          limitBuyTimes: 2, //0代表不限次数, 默认 0
          autoGroup: true,
          actProdSkuList: [
            {
              id: 1,
              skuId: 5,
              prodId: 4,
              name: "uuu",
              pic: "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
              attribute: '[{"颜色": "红色"}]',
              supplierPrice: 1700,
              salePrice: 2000,
              referencePrice: 2200,
              remained: 200,
              actStore: 50,
              actPrice: 1900.05,
            },
            {
              id: 2,
              skuId: 1,
              prodId: 4,
              name: "xxx",
              pic: "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
              attribute: '[{"颜色": "黑色"}]',
              supplierPrice: 1700,
              salePrice: 2000,
              referencePrice: 2200,
              remained: 200,
              actStore: 50,
              actPrice: 2000.06,
            },
          ],
        },
      };
    },
  },

  {
    //3.2.编辑活动接口
    url: "/dev-api/api/v1/activity/group",
    statusCode: 200,
    method: "put",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
      };
    },
  },
];

export default mock;
